﻿using System;
using System.Runtime.InteropServices;

public static class MouseSimulation
{
    [DllImport("user32.dll")]
    private static extern void mouse_event(int dwFlags, int dx, int dy, uint dwData, IntPtr dwExtraInfo);

    public const int MOUSEEVENTF_ABSOLUTE   = 0x8000;
    public const int MOUSEEVENTF_LEFTDOWN   = 0x0002;
    public const int MOUSEEVENTF_LEFTUP     = 0x0004;
    public const int MOUSEEVENTF_MIDDLEDOWN = 0x0020;
    public const int MOUSEEVENTF_MIDDLEUP   = 0x0040;
    public const int MOUSEEVENTF_MOVE       = 0x0001;
    public const int MOUSEEVENTF_RIGHTDOWN  = 0x0008;
    public const int MOUSEEVENTF_RIGHTUP    = 0x0010;
    public const int MOUSEEVENTF_WHEEL      = 0x0800;
    public const int MOUSEEVENTF_XDOWN      = 0x0080;
    public const int MOUSEEVENTF_XUP        = 0x0100;
    public const int MOUSEEVENTF_HWHEEL     = 0x01000;

    public static void MouseMove()
    {
    }

    public static void MouseButton0Down()
    {
        mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, IntPtr.Zero);
    }

    public static void MouseButton0Up()
    {
        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, IntPtr.Zero);
    }

    public static void MouseButton1Down()
    {
        mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, IntPtr.Zero);
    }

    public static void MouseButton1Up()
    {
        mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, IntPtr.Zero);
    }

    public static void MouseButton2Down()
    {
        mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, IntPtr.Zero);
    }

    public static void MouseButton2Up()
    {
        mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, IntPtr.Zero);
    }
}
